(function() {

    // 动物类
    class Animal{
        name:String;
        age: number;

        constructor(name: string,age:number){
            this.name = name;
            this.age = age;
        }

        say(msg:string) {
            console.log(`${this.name}:${msg}`)
        }
    }

    // 狗类
    class Dog  extends Animal{
        run() {
            console.log(`${this.name}：打滚！！！`)
        }
    }

    // 猫类
    class Cat  extends Animal{
        fishing() {
            console.log(`${this.name}：钓鱼！！！`)
        }
    }

    const dog1 = new Dog("狗子",2)
    const cat1 = new Cat("汤姆",1)
    console.log(dog1.say("我是人类忠实的朋友"))
    console.log(cat1.fishing())
})()